<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <!--edge浏览器H5兼容设置-->
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!--360浏览器H5兼容设置-->
   <meta name="renderer" content="webkit" />
    <title>订单管理</title>
    <link rel="stylesheet" type="text/css" href="../bootstrap3/css/bootstrap.css">
	<link rel="stylesheet" type="text/css" href="../bootstrap3/font-awesome-4.7.0/css/font-awesome.css" />
    <!-- 自定义样式 -->
	<link rel="stylesheet" type="text/css" href="../css/click.css" />
</head>
<body>

	<div class="container" id="d1">
	<div class="row">
		<!-- 标题 -->
		<div  class="col-md-12" id="row1">
			<div id="topheader">
				 <h1 id="title">
                 <span>用户管理系统</span><a href="index.html"> - 返回首页</a>
             </h1>
			</div>
		</div>
		<!-- 筛选栏 -->	
		<div class="col-md-12" id="row2">
			<ul class="nav nav-tabs">
 				<li id="getAll" role="presentation" class="active"><a href="#">全部订单</a></li>
  				<li id="getNoComplete" role="presentation" class=""		><a href="#">预定订单</a></li>
  				<li id="getEffective" role="presentation" class=""		><a href="#">正在进行的订单</a></li>
  				<li id="getComplete" role="presentation" class=""		><a href="#">已完成的订单</a></li>
			</ul>
		</div>
		<!-- 信息 -->
		<div class="col-md-12" id="row3">
			<table class="table table-bordered">
				<tr>
					<th>订单</th>
					<th>用户名</th>
					<th>停车场</th>
					<th>停车场位置</th>
					<th>用户电话</th>
					<th>车牌号码</th>
				</tr>
				<tr>
					<td>1</td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td>2</td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td>3</td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
				</tr>
				<tr>
					<td>4</td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
					<td></td>
				</tr>
			</table>
		</div>
		<!-- 脚 -->
		<div class="col-md-12" id="row4">
			<div class="col-md-offset-3 clol-md-12">
			<div class=" btn-group " role="group" aria-label="...">
  				<button type="button" class="btn btn-default">1</button>
  				<button type="button" class="btn btn-default">2</button>
  				<button type="button" class="btn btn-default">3</button>
  				<button type="button" class="btn btn-default">4</button>
  				<button type="button" class="btn btn-default">5</button>
  				<button type="button" class="btn btn-default">6</button>
  				<button type="button" class="btn btn-default">...</button>
  				<button type="button" class="btn btn-default">12</button>
  				<button type="button" class="btn btn-default">13</button>
			</div>
			</div>
		</div>
	</div>
	</div>


	<script type="text/javascript" src="../bootstrap3/jquery.min.js"></script>
	<script type="text/javascript" src="../bootstrap3/js/bootstrap.js"></script>
	<script type="text/javascript" src="../bootstrap3/js/holder.js"></script>
	<script type="text/javascript" src="../bootstrap3/js/html5shiv.min.js"></script>
	<script type="text/javascript" src="../bootstrap3/js/css3-mediaqueries.js"></script>
	<script type="text/javascript" src="../bootstrap3/js/respond.min.js"></script>

	<script type="text/javascript" src="../js/jquery-1.4.2.js"></script>
	<script type="text/javascript">

$("#row2>ul>li").click(function(){
	$(this).siblings("li").removeClass('active');
	$(this).addClass('active');
});


$("#getAll").click(function () {
	 //alert("全部订单");
    $.ajax({
        "url":"/orders/getModifiedTime",
        "contentType":false,
        "processData":false,
        "type":"post",
        "dataType":"json",
        "success":function(json) {
            if (json.state == 2000) {
                $("#d").empty();
                let list  = json.data;
                alert("查询成功");
                console.log(list);
                for(var i=0;i<list.length;i++){
                    let html = '<tr align="center">'
                        +'<td>订单id:#{oid}</td>'
                        +''
                        +'<td>用户名:#{uName}</td>'
                        +' '
                        +'<td>停车场的名字:#{name}</td>'
                        +' '
                        +'<td>停车场具体位置:#{location}</td>'
                        +' '
                        +'<td>订单金额:#{price}</td>'
                        +' '
                        +'<td>用户电话:#{uPhone}</td>'
                        +' '
                        +'<td>用户电话:#{uCarNum}</td>'
                        +'</tr>';
                    html = html.replace(/#{oid}/g,list[i].oid);
                    html = html.replace(/#{uName}/g,list[i].uName);
                    html = html.replace(/#{name}/g,list[i].name);
                    html = html.replace(/#{location}/g,list[i].location);
                    html = html.replace(/#{price}/g,list[i].price);
                    html = html.replace(/#{uPhone}/g,list[i].uPhone);
                    html = html.replace(/#{uCarNum}/g,list[i].uCarNum);

                    $("#d").append(html);
                }

            } else {
                alert("失败" + json.message + "！");
            }
        },
        "error":function() {
            alert("您的登录信息已经过期！请重新登录！");
            // location.href = "login.html";
        }
    });
});

$("#getNoComplete").click(function () {
	 //alert("预定订单");
    $.ajax({
        "url":"/orders/findNoCompleteOrder",
        "contentType":false,
        "processData":false,
        "type":"post",
        "dataType":"json",
        "success":function(json) {
            if (json.state == 2000) {
                $("#d").empty();
                let list  = json.data;
                alert("查询成功");
                console.log(list);
                for(var i=0;i<list.length;i++){
                    let html = '<tr align="center">'
                        +'<td>订单id:#{oid}</td>'
                        +''
                        +'<td>用户名:#{uName}</td>'
                        +' '
                        +'<td>停车场的名字:#{name}</td>'
                        +' '
                        +'<td>停车场具体位置:#{location}</td>'
                        +' '
                        +'<td>订单金额:#{price}</td>'
                        +' '
                        +'<td>用户电话:#{uPhone}</td>'
                        +' '
                        +'<td>用户电话:#{uCarNum}</td>'
                        +'</tr>';
                    html = html.replace(/#{oid}/g,list[i].oid);
                    html = html.replace(/#{uName}/g,list[i].uName);
                    html = html.replace(/#{name}/g,list[i].name);
                    html = html.replace(/#{location}/g,list[i].location);
                    html = html.replace(/#{price}/g,list[i].price);
                    html = html.replace(/#{uPhone}/g,list[i].uPhone);
                    html = html.replace(/#{uCarNum}/g,list[i].uCarNum);

                    $("#d").append(html);
                }

            } else {
                alert("失败" + json.message + "！");
            }
        },
        "error":function() {
            alert("您的登录信息已经过期！请重新登录！");
            // location.href = "login.html";
        }
    });
});

$("#getEffective").click(function () {
	 //alert("正在进行的订单");
    $.ajax({
        "url":"/orders/findEffectiveOrder",
        "contentType":false,
        "processData":false,
        "type":"post",
        "dataType":"json",
        "success":function(json) {
            if (json.state == 2000) {
                $("#d").empty();
                let list  = json.data;
                alert("查询成功");
                console.log(list);
                for(var i=0;i<list.length;i++){
                    let html = '<tr align="center">'
                        +'<td>订单id:#{oid}</td>'
                        +''
                        +'<td>用户名:#{uName}</td>'
                        +' '
                        +'<td>停车场的名字:#{name}</td>'
                        +' '
                        +'<td>停车场具体位置:#{location}</td>'
                        +' '
                        +'<td>订单金额:#{price}</td>'
                        +' '
                        +'<td>用户电话:#{uPhone}</td>'
                        +' '
                        +'<td>用户电话:#{uCarNum}</td>'
                        +'</tr>';
                    html = html.replace(/#{oid}/g,list[i].oid);
                    html = html.replace(/#{uName}/g,list[i].uName);
                    html = html.replace(/#{name}/g,list[i].name);
                    html = html.replace(/#{location}/g,list[i].location);
                    html = html.replace(/#{price}/g,list[i].price);
                    html = html.replace(/#{uPhone}/g,list[i].uPhone);
                    html = html.replace(/#{uCarNum}/g,list[i].uCarNum);

                    $("#d").append(html);
                }

            } else {
                alert("失败" + json.message + "！");
            }
        },
        "error":function() {
            alert("您的登录信息已经过期！请重新登录！");
            // location.href = "login.html";
        }
    });
});

$("#getComplete").click(function () {
	 //alert("已完成的订单");
    $.ajax({
        "url":"/orders/findCompletedOrder",
        "contentType":false,
        "processData":false,
        "type":"post",
        "dataType":"json",
        "success":function(json) {
            if (json.state == 2000) {
                $("#d").empty();
                let list  = json.data;
                alert("查询成功");
                console.log(list);
                for(var i=0;i<list.length;i++){
                    let html = '<tr align="center">'
                        +'<td>订单id:#{oid}</td>'
                        +''
                        +'<td>用户名:#{uName}</td>'
                        +' '
                        +'<td>停车场的名字:#{name}</td>'
                        +' '
                        +'<td>停车场具体位置:#{location}</td>'
                        +' '
                        +'<td>订单金额:#{price}</td>'
                        +' '
                        +'<td>用户电话:#{uPhone}</td>'
                        +' '
                        +'<td>用户电话:#{uCarNum}</td>'
                        +'</tr>';
                    html = html.replace(/#{oid}/g,list[i].oid);
                    html = html.replace(/#{uName}/g,list[i].uName);
                    html = html.replace(/#{name}/g,list[i].name);
                    html = html.replace(/#{location}/g,list[i].location);
                    html = html.replace(/#{price}/g,list[i].price);
                    html = html.replace(/#{uPhone}/g,list[i].uPhone);
                    html = html.replace(/#{uCarNum}/g,list[i].uCarNum);

                    $("#d").append(html);
                }

            } else {
                alert("失败" + json.message + "！");
            }
        },
        "error":function() {
            alert("您的登录信息已经过期！请重新登录！");
            // location.href = "login.html";
        }
    });
});
</script>
</body>
	

</html>